// hyb_yl/pharmacy/pages/sleep/sleep.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },
  selectChange:function(e){
    var that = this;
    var selectTime=e.detail.dateString;// 点击选中的时间，字符串类型
    console.log(selectTime)
    that.setData({
      time:selectTime
    })
    that.getList();
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var date=new Date()
    console.log(date)
    var y=date.getFullYear()
    var m=date.getMonth()+1
    var r=date.getDate()
    
    var ms = m;
    var rs = r;
    if(ms<10)
    {
      ms = "0"+ms;
    }
    if(rs < 10)
    {
      rs = "0"+rs;
    }
    y+'/'+m+'/'+r
    this.setData({
      spot:[y+'/'+m+'/'+r],
      time:y+'-'+ms+'-'+rs
    })
    var j_id = options.j_id;
    that.setData({
      j_id:j_id
    })
    that.getList();
    app.util.request({
      'url':"entry/wxapp/index.equipment_content",
      data:{
        contents:'sport_content'
      },
      success:function(res){
        that.setData({
          content:res.data
        })
      }
    })
  },
  getList:function(){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/index.user_sport",
      data:{
        j_id:that.data.j_id,
        openid:wx.getStorageSync('openid'),
        time:that.data.time,
      },
      success:function(res){
        that.setData({
          info:res.data
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})